<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/18 0018
  Time: 20:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>搜索条件</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">客户:</label>
        <div class="layui-input-inline">
            <%--<select name="customer_Id" >
                <option value="">请选择</option>
                <option value="101">客户1</option>
                <option value="102">客户2</option>
                <option value="103">客户3</option>
            </select>--%>
            <select name="customer_Id">
                <option value="">请选择</option>
                <c:forEach items="${sessionScope.customers}" var="customer">
                    <option value="${customer.id}">${customer.name}</option>
                </c:forEach>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">服务类型:</label>
        <div class="layui-input-inline">
            <select name="type" >
                <option value="">请选择</option>
                <option value="投诉">投诉</option>
                <option value="咨询">咨询</option>
                <option value="售后">售后</option>
                <option value="售中">售中</option>
                <option value="售前">售前</option>
            </select>
        </div>
        <label class="layui-form-label">紧急程度:</label>
        <div class="layui-input-inline">
            <select name="emergency" >
                <option value="">请选择</option>
                <option value="紧急">紧急</option>
                <option value="非常紧急">非常紧急</option>
                <option value="一般">一般</option>
            </select>
        </div>
    </div>

    <%--<div class="layui-form-item">
        <label class="layui-form-label">服务状态:</label>
        <div class="layui-input-inline">
            <select name="type"  lay-verify="required">
                <option value="">请选择</option>
                <option value="投诉">投诉</option>
                <option value="咨询">咨询</option>
                <option value="售后">售后</option>
                <option value="售中">售中</option>
                <option value="售前">售前</option>
            </select>
        <label class="layui-form-label">客户满意度：</label>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <select name="credit">
                    <option value="">请选择</option>
                    <option value="1">☆</option>
                    <option value="2">☆☆</option>
                    <option value="3">☆☆☆</option>
                    <option value="4">☆☆☆☆</option>
                    <option value="5">☆☆☆☆☆</option>
                </select>
            </div>
        </div>
    </div>--%>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="search">查询</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form','jquery'], function(){
        var layer = layui.layer;
        var form = layui.form;
        var $=layui.$;

        //异步提交表单
        form.on("submit(search)",function (data) {
            $.post("${pageContext.request.contextPath}/service/search",data.field,function (result) {
                if (result.code==0){
                    layer.msg("查询成功！");
                    //刷新父窗口内容
                    parent.layui.table.reload("test",{
                        where:{
                            params:data.field
                        },//查询条件
                        page:{
                            curr:1
                        }
                    });
                    //关闭弹出
                    var index=parent.layer.getFrameIndex(window.name);//先得到当前frame层的索引
                    parent.layer.close(index);//再执行关闭
                }
            },"json")
            return false;//阻止表单提交
        })
    });
</script>

</body>
</html>
